<template>
    <div>
        <!-- 导航 -->
        <userTopMenu></userTopMenu>
        <!-- 三种卡片组件 -->
        <p v-if="flag1" style="font-size: 50px;text-align: center;">酒店</p>
        <p v-else style="font-size: 50px;text-align: center;">暂无酒店数据！</p>
        <hr>
        <hotelcards :formInline="formInline" @has-data="hasData1()"></hotelcards>

        <p v-if="flag2" style="font-size: 50px;text-align: center;">景点</p>
        <p v-else style="font-size: 50px;text-align: center;">暂无景点数据！</p>
        <hr>
        <landmarkcards :formInline="formInline" @has-data="hasData2()"></landmarkcards>

        <p v-if="flag3" style="font-size: 50px;text-align: center;">套餐</p>
        <p v-else style="font-size: 50px;text-align: center;">暂无套餐数据！</p>
        <hr>
        <packagecards :formInline="formInline" @has-data="hasData3()"></packagecards>
    </div>
</template>

<script>
import userTopMenu from "../../components/menu/userTopMenu.vue"
import hotelcards from "../../components/cards/hotelCards.vue"
import landmarkcards from "../../components/cards/landmarkCards.vue"
import packagecards from "../../components/cards/packageCards.vue"
export default{
    name:"result",
    components: {
        userTopMenu,
        hotelcards,
        landmarkcards,
        packagecards
  },
    data() {
        return {
            formInline:{},
            //是否有值标识，默认为true，分别对应酒店、景点和套餐
            flag1:true,
            flag2:true,
            flag3:true,
        }
    },
    methods: {
        //接收首页传递的参数
        getParams(){
            this.formInline = this.$route.params.formInline;
        },
        //发起请求，查看是否有值
        hasData1(){
            this.flag1 = false;
        },
        hasData2(){
            this.flag2 = false;
        },
        hasData3(){
            this.flag3 = false;
        },
    },
    //组件先加载，所以改用created先把值传进来
    created() {
        this.getParams();
    },
    
}
</script>

<style scoped>
</style>